package com.libc.yygh.common.helper;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * *
 * Created with Description:    <br>
 * Mybatis plus Handler配置类
 *
 * @fileRelativePath: CommonMetaObjectHandler.java
 * @Date: Created on 2022/4/7  14:39  <br>
 * @author: LiBencheng <br>
 * @version: 1.0 <br>
 */
@Component
public class CommonMetaObjectHandler implements MetaObjectHandler
{

    @Override
    public void insertFill(MetaObject metaObject)
    {
        this.setFieldValByName("createTime", new Date(), metaObject);
        this.setFieldValByName("updateTime", new Date(), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject)
    {
        this.setFieldValByName("updateTime", new Date(), metaObject);
    }
}
